package com.nineclock.message.listener;

import com.nineclock.message.service.NcMessageService;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@RocketMQMessageListener(topic = "allowedJoinCompanyTopic", consumerGroup = "allowedConsumerGroup")
@Slf4j
public class AllowedJoinCompanyListener implements RocketMQListener<String> {

    @Autowired
    private NcMessageService messageService;

    @Override
    public void onMessage(String messageId) {
        log.info("----> 获取到的消息: " + messageId);
        messageService.updateMessageWithApproved(messageId);
    }

}
